﻿<!DOCTYPE html>
<html>

<head>
    <title>CefSharpDemo</title>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <style type="text/css">
    </style>

    <script type="text/javascript">
        //测试JS调用C#方法
        function testCallCSharp() {
            if (jsObjExists()) jsObj.TestCallCSharp("测试参数123");
        }

        //测试C#调用JS方法
        function testCallJs(data) {
            alert("测试C#调用JS方法：" + data);
        }

        //判断jsObj是否存在
        function jsObjExists() {
            return typeof (jsObj) != typeof (undefined);
        }
    </script>
</head>

<body>
    <!--enctype="multipart/form-data"-->
    <form method="post" action="http://localhost:1209/netcms/" target="_blank">
        <span>name:</span><input type="text" name="name" value="测试名称" />
        <span>code:</span><input type="text" name="code" value="测试编码" />

        <button type="submit">Post提交</button>
    </form>
    <br />
    <input type="button" value="测试调用C#方法" title="测试调用C#方法" onclick="testCallCSharp()" />
    <script type="text/javascript">
        if (jsObjExists()) jsObj.MapLoaded(); //页面加载完成时调用C#方法

        document.write("<br /><br />");
        var str = "";
        for (name in window) {
            str += name + "<br />";
            if (name.indexOf("jsObj") >= 0) {
                document.write(name + "<br />");
            }
            if (name.indexOf("chrome") >= 0) {
                document.write(name + "<br />");
            }
        }
        document.write("<br /><br />");
        document.write(str);
    </script>
</body>

</html>